local skel = fk.CreateSkill {
  name = "efengqi__xingshang",
}

Fk:loadTranslationTable{
  ["efengqi__xingshang"] = "行殇",
  [":efengqi__xingshang"] = "当其他角色死亡时，你可以选择一项：1.获得其所有牌；2.回复1点体力。",

  ["efengqi__xingshang_obtain"] = "获得 %dest 的所有牌",

  ["$efengqi__xingshang1"] = "我的是我的，你的还是我的。",
  ["$efengqi__xingshang2"] = "来，管杀还管埋！",
}

skel:addEffect(fk.Death, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and not (target:isNude() and not player:isWounded())
  end,
  on_cost = function(self, event, target, player, data)
    local choices = {"Cancel"}
    if player:isWounded() then table.insert(choices, 1, "recover") end
    if not target:isNude() then table.insert(choices, 1, "efengqi__xingshang_obtain::" .. target.id) end
    local choice = player.room:askToChoice(player, { choices = choices, skill_name = skel.name})
    if choice ~= "Cancel" then
      event:setCostData(self, { choice = choice, tos = {target} } )
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event:getCostData(self).choice == "recover" then
      room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = skel.name,
      })
    else
      room:obtainCard(player, target:getCardIds("he"), false, fk.ReasonPrey, player, skel.name)
    end
  end,
})



return skel
